Spring Boot学习笔记(四) -编写HelloWorld
创建项目
- 创建一个空项目
- 创建模块
))))编写POM文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xiezhenyu</groupId>
<artifactId>springboothellowrold2</artifactId>
<version>1.0-SNAPSHOT</version>
<!-- 继承 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.6.RELEASE</version>
</parent>
<!-- 依赖 -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<!-- 插件 -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
修改Tomacat端口
1 | server: |
创建启动类
1 | package com.xiezhenyu; |
创建Controller
1 | package com.xiezhenyu.controller; |
运行结果
原文作者: 谢振瑜
原文链接: https://Xiezhenyu98.github.io/2020/04/06/Spring Boot学习笔记(四) -编写HelloWorld/
版权声明: 转载请注明出处(必须保留作者署名及链接)